home *** CD-ROM | disk | FTP | other *** search
- Path: cymbal.aix.calpoly.edu!not-for-mail
- From: dstubbs@cymbal.aix.calpoly.edu (Dan Stubbs)
- Newsgroups: comp.lang.c
- Subject: Re: Limit on #bytes inside of struct?
- Date: 9 Feb 1996 10:41:23 -0800
- Organization: California Polytechnic State University, San Luis Obispo
- Message-ID: <4fg4gj$4gk4@cymbal.aix.calpoly.edu>
- References: <4feg1d$d4g@cville-srv.wam.umd.edu>
- NNTP-Posting-User: dstubbs@cymbal.aix.calpoly.edu
-
- In article <4feg1d$d4g@cville-srv.wam.umd.edu>,
- jeffrey d squires <jsquires@wam.umd.edu> wrote:
- >I have the following:
- >
- >typedef struct {
- > int zero;
- > int one;
- ...
- > int six;
- > int seven_or_more;
- >} hist_type;
- >
- >hist_type histogram;
- >int num=2;
- >
- >histogram.zero = 0;
- ...
- >histogram.four = 0; /* at this point, value of num changes from 2 to 0!!!*/
- >
- >Is there a limit on the number of bytes allowed inside of a struct?
- >This is completely crazy!
- >
- > jsquires@umiacs.umd.edu
- >
- >
- I tested this by placing an array inside the struct instead of
- individual items. (Sample code in another response to this post.)
- The result was that a segmentation fault was reported when the
- array, and hence the struct was too big. The value of num was
- never corrupted. How big was too big?
-
-
- If the struct components must fit in one segment of memory, how
- big might that segment be? This is presumably system dependent.
- In my case it appears to be a 32MB segment. Recall that 32MB is
- 33,554,432 bytes. I used an array of integers (four bytes each)
- so the largest array would be 8,388,608 components. The actual
- largest array permitted was about 8,388,300 components--so the
- entire segment was not available for the array. Perhaps the
- program must fit in that segment also?
-
-
-